package com.epam.giorgadze.task1.runner;

import com.epam.giorgadze.task1.entity.AirCompany;
import com.epam.giorgadze.task1.entity.plane_type.CargoPlane;
import com.epam.giorgadze.task1.entity.plane_type.PassengerPlane;
import com.epam.giorgadze.task1.factory.AirCompanyFactory;
import com.epam.giorgadze.task1.logic.AirCompanyLogic;
import com.epam.giorgadze.task1.printer.AirCompanyPrinter;

import java.util.List;

/**
 * User: Luka
 * Date: 15.02.14
 * Time: 19:18
 */
public class AirCompanyRunner {
    public static void main(String[] args) throws InstantiationException, IllegalAccessException {
        AirCompany unitedAirlines = AirCompanyFactory.createRandomAirCompany(5);
        unitedAirlines.setAirportName("United Airlines");
        AirCompanyPrinter.print(unitedAirlines);

        AirCompanyLogic.sortByTravelingDistance(unitedAirlines.getPlanes());
        AirCompanyPrinter.print(unitedAirlines);

        AirCompanyLogic.sortByNumberOfSeats(AirCompanyLogic.findPassangerPlanes(unitedAirlines.getPlanes()));
        List<CargoPlane> cargoPlanes = AirCompanyLogic.findCargoPlanes(unitedAirlines.getPlanes());

        AirCompanyLogic.sortByTonnage(cargoPlanes);
        System.out.println(cargoPlanes);

        List<PassengerPlane> passengerPlanes = AirCompanyLogic.findPassangerPlanes(unitedAirlines.getPlanes());
        AirCompanyLogic.sortByNumberOfSeats(passengerPlanes);
        AirCompanyPrinter.print(passengerPlanes);

        System.out.println(AirCompanyLogic.findPlanesByFuelConsumption(10.00, 30.00, unitedAirlines.getPlanes()));
        System.out.println("Tonnage sum is: " + AirCompanyLogic.tonnageSum(AirCompanyLogic.findCargoPlanes(unitedAirlines.getPlanes())));
        System.out.println("Total number of seats is: " + AirCompanyLogic.numberOfSeatsSum(AirCompanyLogic.findPassangerPlanes(unitedAirlines.getPlanes())));

    }


}
